﻿$(document).ready(function () {
    $('#frFilterSalesByProduct').submit(function () {
        App.blockUI($("#FilterSalesByProductResult"));
        $.ajax({
            url: '/home/SalesByProduct',
            data: $(this).serialize(),
            method: "Post",
            success: function (data) {
                $("#FilterSalesByProductResult").html(data);
                var $table = $('.fixhead .table-fix');
                $table.floatThead({
                    scrollContainer: function ($table) {
                        return $table.closest('.fixhead');
                    }
                });
                App.unblockUI($("#FilterSalesByProductResult"));
            }
        });
        return false;
    });
    $('#frSurveyStatistic').submit(function () {
        App.blockUI($("#SurveyResult"));
        $.ajax({
            url: '/Survey/SurveyStatistics',
            data: $(this).serialize(),
            method: "Post",
            success: function (data) {
                $("#SurveyResult").html(data);
                App.unblockUI($("#SurveyResult"));
            }
        });
        return false;
    });

  
});
function FilterSalesByUser(id) {
    App.blockUI($("#SalesByUserResult"));
    $.ajax({
        url: '/home/SalesByUser',
        data: { salesInDuration: id },
        method: "Post",
        success: function (data) {
            $("#SalesByUserResult").html(data);
            App.unblockUI($("#SalesByUserResult"));
        }
    });
}

function departmentchange(id) {
    App.blockUI($(".taskbyusers"));
    $.ajax({
        url: '/home/loadtasksbyuser',
        data: { userid: id },
        success: function (data) {
            $(".taskbyusers").html(data);
        }
    });
}